package com.ff.discounts.component.rankinglist

import androidx.recyclerview.widget.GridLayoutManager
import com.ff.discounts.R
import com.ff.discounts.component.tab.home.HistoryData
import com.ff.discounts.databinding.ActivityRankingListBinding
import com.qmuiteam.qmui.util.QMUIStatusBarHelper

/**
 *
 * @author: fufang
 * @date: 2023/10/19
 */
class RankingListActivity  :
    com.ff.discounts.activity.BaseViewModelActivity<ActivityRankingListBinding>(){
    private val rankingAdapter by lazy {
        RankingAdapter()
    }

    override fun initDatum() {
        super.initDatum()
        //绑定adapter
        binding.rankingList.adapter = rankingAdapter
        rankingAdapter.submitList(RankingListActivity.HotList)

        showAddVideoDialog()
    }



    override fun initListeners() {
        super.initListeners()
        binding.back.setOnClickListener {
            finish()
        }
    }

    override fun initViews() {
        super.initViews()
        // 设置沉浸式状态栏
        QMUIStatusBarHelper.translucent(this)

        // 设置rankingAdapter的布局管理器
        val layoutPlayManager = GridLayoutManager(hostActivity, 1)
        binding.rankingList.layoutManager = layoutPlayManager
    }

    private fun showAddVideoDialog() {
        AddVideoDialogFragment.show(supportFragmentManager){

        }
    }

    companion object{
        private val HotList = mutableListOf<HistoryData>(
            HistoryData(R.drawable.photo,"极品校花爱上我", "第五集"),
            HistoryData(R.drawable.photo,"极品校花爱上我", "第五集"),
            HistoryData(R.drawable.photo,"极品校花爱上我", "第五集"),
            HistoryData(R.drawable.photo,"极品校花爱上我", "第五集"),
            HistoryData(R.drawable.photo,"极品校花爱上我", "第五集"),
            HistoryData(R.drawable.photo,"极品校花爱上我", "第五集"),
            HistoryData(R.drawable.photo,"极品校花爱上我", "第五集"),
            HistoryData(R.drawable.photo,"极品校花爱上我", "第五集"),
            HistoryData(R.drawable.photo,"极品校花爱上我", "第五集")
        )
    }
}